from django.contrib import admin
from .models import Category, Article, WebConfig, VisitNumber, UserIp, DayNumber


# Register your models here.

@admin.register(Category)
class CategoryAdmin(admin.ModelAdmin):
    list_display = ['id', 'category']
    search_fields = ['category']
    list_filter = ['category']


@admin.register(Article)
class ArticleAdmin(admin.ModelAdmin):
    list_display = ['id', 'title', 'category', 'author', 'is_new', 'created_time', 'updated']
    search_fields = ['title', 'author', 'category', 'is_new', 'created_time']
    list_filter = ['title', 'author', 'category', 'is_new', 'created_time']


@admin.register(WebConfig)
class WebConfigAdmin(admin.ModelAdmin):
    list_display = ['wechat', 'cellphone', 'email', 'sign', 'banner_img']
    list_filter = ['wechat', 'cellphone', 'email']
    search_fields = ['wechat', 'cellphone', 'email']


@admin.register(VisitNumber)
class VisitNumberAdmin(admin.ModelAdmin):
    list_display = ['count']


@admin.register(UserIp)
class UserIpAdmin(admin.ModelAdmin):
    list_display = ['id', 'ip', 'count']
    list_filter = ['ip']
    search_fields = ['ip']


@admin.register(DayNumber)
class DayNumber(admin.ModelAdmin):
    list_display = ['day', 'count']
